package com.designpattern.softwaredesignpatternstudy.pattern.iterator;

/**
 * @author LitchiShell
 * @description: Iterator设计模式测试类
 * @create 2022-02-01
 */
public class Main {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf(4);
        bookShelf.appendBook(new Book("《活着》"));
        bookShelf.appendBook(new Book("《许山观卖血记》"));
        bookShelf.appendBook(new Book("《兄弟》"));
        bookShelf.appendBook(new Book("《蛙》"));
        Iterator iterator = bookShelf.iterator();
        while(iterator.hasNext()){
            Book book = (Book)iterator.next();
            System.out.println(book.getName());
        }
    }
}
